<?php

/**
 * Green Calc
 * Calc entry point file for Calc Component (reserved. using plugin Calc)
 * 2009-2014 All rights reserved
 * @link http://www.greenkey.ru
 * @license GNU/GPL v3
 */
// No direct access
defined('_JEXEC') or die;

// Проверка доступа.
if (!JFactory::getUser()->authorise('core.manage', 'com_calc')) {
    throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 401);
}

JError::$legacy = false;

// Подключаем хелпер.
JLoader::register('CalcHelper', dirname(__FILE__) . '/helpers/calc.php');

// Устанавливаем некоторые глобальные свойства.
$document = JFactory::getDocument();
$document->addStyleDeclaration('.icon-20-calc {height:20px; width:20px; background-image: url(../media/com_calc/images/calc-20x20.png);}');

// import joomla controller library
jimport('joomla.application.component.controller');

// Get an instance of the controller prefixed by HelloWorld
$controller = JControllerLegacy::getInstance('Calc');

// Perform the Request task and Execute request task
$controller->execute(JFactory::getApplication()->input->getCmd('task', 'display'));

// Redirect if set by the controller
$controller->redirect();
